/*

Archivo: "globals.h"

Declaraciones de constantes, tipos y macros globales.

Autor: Diego Luna

Primera versión: 5-6-2012

*/


#ifndef __GLOBALS_H_INCLUDED
#define __GLOBALS_H_INCLUDED

// Desactivo las excepciones.
#define _HAS_EXCEPTIONS 0

#ifdef _MSC_VER
// Necesaria para VC++.
#define _STATIC_CPPLIB
#endif


/* CmdLine messages - Begin  */

#define LONG_HELP_OPTION								"help"
#define SHORT_HELP_OPTION								"h"
#define HELP_HELP_OPTION								"displays this help and exit."


#define LONG_VERSION_OPTION								"version"
#define SHORT_VERSION_OPTION							"v"
#define HELP_VERSION_OPTION								"displays the program version and exit."


#define INVALID_NON_OPTION_ARGUMENT						"Invalid non-option argument: "
#define REPEATED_OPTION									"Repeated option: "
#define OPTION_REQUIRES									"Option requires "
#define ARGUMENTS										"argument(s)."
#define UNKNOWN_OPTION									"Unknown option: "
#define MISSING_PARAMETER								"Missing parameter: "

#define DOT												'.'
#define SPACE											' '


#define USAGE											"Usage: "
#define OPTION_ELIPSIS									" [OPTION]..."

#define DEFAULT_OPT_DESCRIPTION							". With no OPTION, same as "
#define DESC_OPT_PREFIX									", --"
//#define TABS											"\t\t"

#define VERSION_TEXT									" version: "

/* CmdLine messages - End  */


/* Main messages - Begin  */

#define ERROR_CANNOT_OPEN								"Cannot open "
#define ERROR_UNKNOWN_IMPLEMENTATION					"Unknown implementation "
#define ERROR_UNKNOWN_DATA_TYPE							"Unknown data type "
#define ERROR_BAD_STREAM								"Error, image format not recognized."
#define ERROR_BAD_IMAGE_FORMAT							"Error reading image, bad format."
#define ERROR_WRITING_OUTPUT							"Error writing image."
#define ERROR_TRANSFORMING_IMAGE						"Error transforming image."
#define ERROR_PROCESSING_OPTION							"Error processing commands."

#define ERROR_EXECUTING_SET_COMMAND						"Error executing set command."


#define ERROR_COMMAND_MISSING							"Missing ommand." 
#define ERROR_COMMAND_UNKNOWN							"Unknown command."
#define ERROR_PARAMETER_MISSING							"Parameter missing."
#define ERROR_PARAMETER_NOT_REQUIRED					"Parameter not required."
#define ERROR_INVALID_PARAMETER							"Invalid parameter."


#define ERROR_NUMBER_SUCCESS							0
#define ERROR_NUMBER_COMMAND_PARSING					1
#define ERROR_NUMBER_CANNOT_OPEN						2
#define ERROR_NUMBER_UNKNOWN_IMPLEMENTATION				3
#define ERROR_NUMBER_UNKNOWN_DATA_TYPE  				4
#define ERROR_NUMBER_EXECUTING_SET_COMMAND				5


#define ERROR_NUMBER_BAD_STREAM							100
#define ERROR_NUMBER_BAD_IMAGE_FORMAT					101
#define ERROR_NUMBER_TRANSFORMING_IMAGE					102
#define ERROR_NUMBER_WRITING_OUTPUT						103


#define HELP_TEXT_ISTREAM								"Input file."
#define HELP_TEXT_OSTREAM								"Output file."
#define HELP_TEXT_IMPLEMENTATION						"Internal implementation to use."
#define HELP_TEXT_DATA_TYPE								"Set data type."


#define TRUE_STR										"true"
#define FALSE_STR										"false"


#define IMPLEMENTING									"Implementing set with class: "
#define COMPLETE										"Completed process without any errors."


/* Main messages - End  */


/* Abort messages - Begin  */

#define BAD_ITERATOR									"Fatal error. Bad iterator."

#define BAD_IMPLEMENTOR									"Fatal error. Implementor not set."

#define BAD_COMMAND										"Fatal error. Bad command."

#define BAD_HASH_TYPE									"Fatal error. Hash function not defined for the given type."

/* Abort messages - End  */

// Esta definición asegura que
// un byte puede, al menos, guardar
// valores hasta 255.
typedef unsigned char byte;


#define FATAL_ERROR(ERROR_MESSAGE) {std::cerr<<ERROR_MESSAGE; abort();}

#define SET_ERROR_DESCRIPTION(ERROR_NUMBER) 


#endif
